<template>
    <aplid-base-crud ref="crud" class="w-100" v-bind="baseConfig" >
      <template v-slot:ArchivesDialog="{ row, show }">
        <Archives v-if="show" :nowRowData="row"></Archives>
      </template>
      <!-- 上链接状态 -->
      <template v-slot:onBlockchainFlag = "{row}">
        <div class="chain_status">
          <el-tag :type="judgeDict(row.onBlockchainFlag).remarks">{{ judgeDict(row.onBlockchainFlag).label }}</el-tag>
        <el-icon style="margin-left: 10px;" :size="size" :color="color" @click="handleOperate('Archives',row,'详情')">
          <Warning/>
        </el-icon>
        </div>
      </template>
    </aplid-base-crud>
</template>

<script setup>
import {baseConfig} from './config'
import Archives from './Archival/index.vue'
import {useCommonStore} from '@/stores/common'
import {Warning} from '@element-plus/icons-vue'
const CommonStore = useCommonStore()
const {dictList} = storeToRefs(CommonStore)

let props = defineProps({
  nowRowData:{
    type:Object,
    default:()=>({})
  }
})

let BlockchainFlag = ref({})
const judgeDict = (onBlockchainFlag) =>{
  let list = dictList.value['BLOCK_CHAIN_STATUS']
  let obj = list.find(el=>{
      return el.value == onBlockchainFlag
  })
  BlockchainFlag.value = obj
  return obj
}

let crud = ref()
const handleOperate = (type, row, title) => {
  nextTick(() => {
    crud.value.handleOperate(type, row, title)
  })
}


</script>

<style lang="scss" scoped>
.chain_status{
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
}
</style>
